package com.cn.system.common.dto;

import java.io.Serializable;

/**
 * @Company <Jinher Technology Development Company LTD..>
 * @Project <CL-Allocation tool>
 * @version <1.0>
 * @Author  <chenjx>
 * @Date    <Apr 28, 2011>
 * @description < 业务操作结果封装,该类用来转化成JSON格式数据向页面作出响应 >
 */
@SuppressWarnings("serial")
public class ResultsBean implements Serializable{
	/**
	 * 操作成功或者是失败
	 */
	protected Boolean success;
	
	/**
	 * 存放String型操作码
	 */
	protected String code;
	
	/**
	 * 要输出的信息
	 */
	protected String message;
	
	/**
	 * 存放数据
	 */
	protected Object data;
	
	public ResultsBean(){
		this.success = true;
	}
	
	public Boolean getSuccess() {
		return success;
	}
	public void setSuccess(Boolean success) {
		this.success = success;
	}
	public String getCode() {
		return code;
	}
	public void setCode(String code) {
		this.code = code;
	}
	public Object getData() {
		return data;
	}
	public void setData(Object data) {
		this.data = data;
	}
	public String getMessage() {
		return message;
	}
	public void setMessage(String message) {
		this.message = message;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((code == null) ? 0 : code.hashCode());
		result = prime * result + ((data == null) ? 0 : data.hashCode());
		result = prime * result + ((message == null) ? 0 : message.hashCode());
		result = prime * result + ((success == null) ? 0 : success.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		final ResultsBean other = (ResultsBean) obj;
		if (code == null) {
			if (other.code != null)
				return false;
		} else if (!code.equals(other.code))
			return false;
		if (data == null) {
			if (other.data != null)
				return false;
		} else if (!data.equals(other.data))
			return false;
		if (message == null) {
			if (other.message != null)
				return false;
		} else if (!message.equals(other.message))
			return false;
		if (success == null) {
			if (other.success != null)
				return false;
		} else if (!success.equals(other.success))
			return false;
		return true;
	}
	
}
